


package com.ncloud.crm.mapper;

import org.apache.ibatis.annotations.*;

import com.ncloud.crm.entity.BsProject;
import com.ncloud.crm.entity.order.OrderProject;

import java.util.List;

/**
 * Created by shiqiang on 2017/4/11.
 */
@Mapper
public interface OrderProjectMapper {
    @Select(value = { "select * from bs_o_project where order_id = #{orderId}" })
    @Results({ @Result(column = "order_id", property = "orderId"), @Result(column = "modify_tag", property = "modifyTag"),
            @Result(column = "project_id", property = "projectId"),@Result(column = "cust_id", property = "custId"),
            @Result(column="project_name",property="projectName"),@Result(column="manager",property="manager"),
            @Result(column="test_flag",property="testFlag"),@Result(column="create_time",property="createTime"),
            @Result(column="contact_phone",property="contactPhone"),@Result(column="contact_name",property="contactName"),
            @Result(column="create_user",property="createUser"),@Result(column="destroy_time",property="destroyTime"),
            @Result(column="update_time",property="updateTime"),@Result(column="update_user",property="updateUser"),
            @Result(column="remark",property="remark")
    })
	public List<OrderProject> getProjectByOrderId(Long orderId);
	@Insert(value = "insert into bs_o_project(order_id,modify_tag,project_id,cust_id,project_name,manager,test_flag,create_time,contact_phone,contact_name," +
			"create_user,destroy_time,update_time,update_user,remark) values(#{orderId},#{modifyTag}," +
			"#{projectId},#{custId},#{projectName},#{manager},#{testFlag},#{createTime},#{contactPhone},#{contactName}," +
			"#{createUser},#{destroyTime},#{updateTime},#{updateUser},#{remark})")
	public int insertOrderProject(OrderProject orderProject);
  //提供给销售查询自己录入的订单的状态
	 @Select(value = { "select * from bs_project where manager = #{0}" })
	    @Results({ @Result(column = "project_id", property = "projectId"), @Result(column = "cust_id", property = "custId"),
	            @Result(column = "project_name", property = "projectName"),@Result(column = "contact_name", property = "contactName"),
	            @Result(column = "contact_phone", property = "contactPhone"),@Result(column = "test_flag", property = "testFlag"),
	            @Result(column="state",property="state"),@Result(column="manager",property="manager"),
	            @Result(column="create_time",property="createTime"),@Result(column="create_user",property="createUser"),
	            @Result(column="destory_time",property="destoryTime"),@Result(column="update_time",property="updateTime"),
	            @Result(column="update_user",property="updateUser"),@Result(column="remark",property="remark")})
	    public List<BsProject> getManager(String manager);
	 

}


